const state = {
  path: '/'
}

// getters
const getters = {
  url: (state) => (key) => {
    return state.path
  }
}

// actions
const actions = {
  in: function ({ commit }) {
    let path = window.location.href.split('#')
    commit('setPath', (path[1] || '/'))
  },
  out: function ({ commit }) {
    commit('setPath', '/')
  }
}

// mutations
const mutations = {
  setPath: function (state, res) {
    state.path = res
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
